package com.projecthost.wizaz.model;

import java.io.Serializable;

public class Review implements Serializable {

    private static final long serialVersionUID = -3022348413410407917L;
    private final Float starsValue;
    private final String reviewSummary;
    private final String reviewFull;
    private final Integer productId;
    private final Integer reviewId;

    public Review(Integer productId, Integer reviewId, Float starsValue, String reviewSummary, String reviewFull) {
        this.productId = productId;
        this.reviewId = reviewId;
        this.starsValue = starsValue;
        this.reviewSummary = reviewSummary;
        this.reviewFull = reviewFull;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((productId == null) ? 0 : productId.hashCode());
        result = prime * result + ((reviewId == null) ? 0 : reviewId.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        Review other = (Review) obj;
        if (reviewId == null) {
            if (other.reviewId != null) {
                return false;
            }
        } else if (!reviewId.equals(other.reviewId)) {
            return false;
        }
        if (productId == null) {
            if (other.productId != null) {
                return false;
            }
        } else if (!productId.equals(other.productId)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Review [reviewId=");
        builder.append(reviewId);
        builder.append(", productId=");
        builder.append(productId);
        builder.append(", starsValue=");
        builder.append(starsValue);
        builder.append(", reviewSummary=");
        builder.append(reviewSummary);
        builder.append(", reviewFull=");
        builder.append(reviewFull);
        builder.append("]");
        return builder.toString();
    }

}
